import request from "@/netword/request";


const fun = {};

//保存数据
fun.saveMenu = async (menu) => {
    const res = await request({
        url: "/a/core/menu/save",
        method: "put",
        params: {
            menuName: menu.menuName,
            menuLink: menu.menuLink,
            menuIcon: menu.menuIcon,
            menuRole: menu.menuRole,
            menuIdent: menu.menuIdent,
            parentId: menu.parentId,
            parentName:menu.parentName,
            sort:menu.sort,
            remarks:menu.remarks,
        }
    })
    return res.data;
}


//更新数据
fun.updateMenu = async (menu) => {
    const res = await request({
        url: "/a/core/menu/update",
        method: "post",
        params: {
            id: menu.id,
            menuName: menu.menuName,
            menuLink: menu.menuLink,
            menuIcon: menu.menuIcon,
            menuRole: menu.menuRole,
            menuIdent: menu.menuIdent,
            parentId: menu.parentId,
            parentName:menu.parentName,
            sort:menu.sort,
            remarks:menu.remarks,
        }
    })
    return res.data;
}

//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/core/menu/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//获取全部菜单数据
fun.getList = async(menu)=>{
    const res =await request({
        url:'/a/core/menu/list',
        method:'post',
        params:{
            menuName:menu.menuName
        }
    })
    return res.data
}


//获取全部菜单数据2
fun.getListRole = async(menu)=>{
    const res =await request({
        url:'/a/core/menu/listRole',
        method:'post',
        params:{
            menuName:menu.menuName
        }
    })
    return res.data
}


export default fun;











